Skip to content

add box-select to ssr/graph (depends on #305)#312

Closed
AjayThorve wants to merge 56 commits into
rapidsai:mainfrom
AjayThorve:demo/ssr/box-select
Closed

add box-select to ssr/graph (depends on #305)#312
AjayThorve wants to merge 56 commits into
rapidsai:mainfrom
AjayThorve:demo/ssr/box-select

Conversation

@AjayThorve
Copy link
Copy Markdown
Member

This PR adds box-select and other interactions (clear selections, return filtered dataframes) for ssr/graph demo and is developed simultaneously with #305 for adding the same functionality to the viz demo app

Comment thread modules/demo/ssr/graph/render/render.js Outdated
Comment on lines +128 to +152
componentDidMount() {
this.dispatchRemoteEvent(this.videoRef.current, 'blur');
this.dispatchRemoteEvent(this.videoRef.current, 'wheel');
this.dispatchRemoteEvent(window, 'beforeunload');
this.dispatchRemoteEvent(document, 'keydown');
this.dispatchRemoteEvent(document, 'keypress');
this.dispatchRemoteEvent(this.videoRef.current, 'mouseup');
this.dispatchRemoteEvent(this.videoRef.current, 'mousemove');
this.dispatchRemoteEvent(this.videoRef.current, 'mousedown');
this.dispatchRemoteEvent(this.videoRef.current, 'mouseenter');
this.dispatchRemoteEvent(this.videoRef.current, 'mouseleave');
}

dispatchRemoteEvent(target, type) {
let timeout = null;
target.addEventListener(type, (e) => {
if (e.target === this.videoRef.current) {
e.preventDefault();
}
if (!timeout) {
timeout = setTimeout(() => { timeout = null; }, 1000 / 60);
this.peer.send(JSON.stringify({ type: 'event', data: serializeEvent(e) }));
}
});
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't add event listeners to DOM elements directly, because React may destroy the underlying DOM element whenever it wants. Instead, use the onMouseUp={} etc. properties of the video element.

@AjayThorve AjayThorve marked this pull request as ready for review October 15, 2021 22:32
@AjayThorve AjayThorve closed this Oct 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants